package edu.vt.cbil.dataset;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;

/**
 * Created by SunMing on 2016/7/5.
 */
public class GeneData {
    private ArrayList<String> geneChr=new ArrayList<>();
    private ArrayList<Integer> geneStart=new ArrayList<>();
    private ArrayList<Integer> geneEnd=new ArrayList<>();
    private ArrayList<Integer> geneId=new ArrayList<>();
    private ArrayList<String> geneName=new ArrayList<>();

    public ArrayList<String> getGeneChr(){
        return geneChr;
    }
    public ArrayList<Integer> getGeneStart(){
        return geneStart;
    }
    public ArrayList<Integer> getGeneEnd(){
        return geneEnd;
    }
    public ArrayList<Integer> getGeneId(){
        return geneId;
    }
    public ArrayList<String> getGeneName(){
        return geneName;
    }

    public void setGeneChr(ArrayList<String> geneChr){
        this.geneChr=geneChr;
    }
    public void setGeneStart(ArrayList<Integer> geneStart){
        this.geneStart=geneStart;
    }
    public void setGeneEnd(ArrayList<Integer> geneEnd){
        this.geneEnd=geneEnd;
    }
    public void setGeneId(ArrayList<Integer> geneId){
        this.geneId=geneId;
    }
    public void setGeneName(ArrayList<String> geneName){
        this.geneName=geneName;
    }

    public void readGeneInfos(String geneFileName){
        File geneFile=new File(geneFileName);
        try {
            InputStreamReader isr=new InputStreamReader(new FileInputStream(geneFile));
            BufferedReader br=new BufferedReader(isr);

            String line=br.readLine();
            while ((line=br.readLine())!=null){
                String[] item=line.split("\t");
                geneChr.add(item[0]);
                geneStart.add(Integer.parseInt(item[1]));
                geneEnd.add(Integer.parseInt(item[2]));
                geneId.add(Integer.parseInt(item[3]));
                geneName.add(item[4]);
            }
        }
        catch (Exception e){
            e.printStackTrace();
        }
    }
}
